package com.xungou.shoppingCart.service.impl;

import com.xungou.core.mvc.AbstractService;
import com.xungou.core.mvc.IDao;
import com.xungou.shoppingCart.dao.IShoppingCart;
import com.xungou.shoppingCart.pojo.ShoppingCart;
import com.xungou.shoppingCart.service.IShoppingCartService;
import com.xungou.utils.UserUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@Service("shoppingCartService")
public class ShoppingCartServiceImpl extends AbstractService<ShoppingCart> implements IShoppingCartService {
    @Resource  
    private IShoppingCart iShoppingCart;

    @Override
    protected IDao<ShoppingCart> getDao() {
        return iShoppingCart;
    }

    @Override
    public List<Map<String,Object>> list(Map<String, Object> params) {
        params.put("userId", UserUtil.getCurrentUser().getId());
        return iShoppingCart.list(params);
    }

    @Override
    public ShoppingCart getShoppingCartByParams(Map<String, String> params) {
        return iShoppingCart.getShoppingCartByParams(params);
    }

    @Override
    public int deleteByIds(Map<String, String> params) {
        return iShoppingCart.deleteByIds(params);
    }
}